// 基础状态
import 'package:flutter/material.dart';

class BaseState {
  // 主App用户登录态
  String? loginToken;
  // 当前页面 Router Path
  String? navigateTo;
  BaseState({this.loginToken, this.navigateTo});
  Map<String, dynamic> toJson(Map<String, dynamic> data) {
    return data;
  }
}

class BaseProvider extends ChangeNotifier {
  late BaseState _baseState;
  BaseProvider({BaseState? baseState}) {
    _baseState = baseState ?? BaseState();
  }
  BaseState get state => _baseState;
  set state(BaseState newStates) {
    _baseState = newStates;
    _baseState.loginToken = newStates.loginToken ?? _baseState.loginToken;
    _baseState.navigateTo = newStates.navigateTo ?? _baseState.navigateTo;
    notifyListeners();
    print('new baseState = $_baseState');
  }
}
